<%@page import="com.pb.poem.util.Page"%>
<%@page import="com.pb.poem.entity.Poem"%>
<%@page import="java.util.List"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
    
    <%@include file="../common/common.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<script type="text/javascript">
function back(){
	window.location="show.jsp";
}


function page_nav(frm,num){
	frm.pageIndex.value=num;
	frm.submit();
}
function jump_to(frm,pageno){
	var regexp=/^\d+$/;
	if(!regexp.test(pageno)){
		alert("请输入正确的数字");
		return false;
	}else{
		page_nav(frm,pageno);
	}
}
</script>
<body>
<table class="list">
  <c:forEach var="poem" items="${List}" varStatus="status"> 
   <table width="500" border="0">
  <tr>
    <td width="499" align="center">${poem.poemname}</td>
  </tr>
  <tr>
    <td align="center" >${poem.dynasty}
     ${poem.author}</td>
  </tr>
  <tr>
    <td align="center" >${poem.content}</td>
  </tr>
</table>
	</c:forEach>
	  </tbody>
	    </table>
<form method="post" action="goodfriend.jsp">
<input type="hidden" name="pageIndex" value="1"/>
<div >
	<li>共${totalCount}条记录&nbsp;&nbsp; ${pageIndex}/${totalPage}页</li>
		<c:if test="${pageIndex>1}">
		  <a href="javascript:page_nav(document.forms[0],1)">首页</a>
		  <a href="javascript:page_nav(document.forms[0],${pageIndex-1})">上一页</a>
		</c:if>
		<c:if test="${pageIndex < totalPage}">
			<a href="javascript:page_nav(document.forms[0],${pageIndex+1})">下一页</a>
			<a href="javascript:page_nav(document.forms[0],${totalPage})">最后一页</a>
				</c:if>
		 <span class="page-go-form"><label>跳转至</label>
	     <input type="text" name="inputPage1" id="inputPage" class="page-key" />页
	     <button type="button" class="page-btn" onClick='jump_to(document.forms[0],document.getElementById("inputPage").value)'>GO</button>
		</span>
	  </div>
	  </form>
 <div>
	 <input type="button" value="返回" onclick="back();"/>
</div>
</body>
</html>